package com.wdhcr.socket.controller;

import com.wdhcr.socket.component.WebSocketServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SocketController {

    @Autowired
    private WebSocketServer webSocketServer;

    @GetMapping("/socket")
    public String socket(@RequestParam("clientID") String clientID) {
        String s = "测试测试";
        webSocketServer.sendMessage(clientID, s);
        return s;
    }

}
